<template>
  <el-dialog
    :title="fromData.title"
    :visible.sync="visible"
    width="60%"
    center
    :close-on-click-modal="false"
    append-to-body
    @closed="$emit('dialog-close')"
  >
    <div>{{$t('page-announcement.d2-crud.column-pubdate')}}:{{ fromData.createTime }}</div>
    <div v-html="fromData.content"></div>
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" @click="submit">{{ $t('page.form.close') }}</el-button>
    </span>
  </el-dialog>
</template>

<script>
import dayjs from 'dayjs'
import { mapState, mapActions } from "vuex";
import ApiMain from '@/api/system.bell';
export default {
  mixins: [],
  props: [],
  data() {
    return {
      visible: false,
      popDeleteVisible: false,
      loading: false,
      formRaw: null,
      fromData: {},
    };
  },
  computed: {
    ...mapState("d2admin/user", {
      user: "info",
    }),
  },
  mounted() {
  },

  methods: {
    async show(item) {
      // let data = await ApiMain.info({ id: item.id })
      // console.log(data)
      let data =item
      data.createTime = dayjs(data.createTime).format('YYYY-MM-DD HH:mm:ss')
      this.fromData = data;
      this.visible = true;
    },

    verifyForm() {
      var bool = true;
      this.$refs["main-form"].validate((valid) => (bool = valid));
      return bool;
    },

    async submit() {

      this.loading = true;
      try {
       await  ApiMain.handelRead({sysAnnouncementId:this.fromData.id})
       this.visible= false
      } finally {
        this.loading = false;
      }
    },


  },
};
</script>

<style>
</style>
